﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Commonlib;
namespace BLL
{
    public class ItemBLL
    {
        private readonly DAL.ItemDAL itemdal = new DAL.ItemDAL();
        /// <summary>
        /// 获取所有款式信息
        /// </summary>
        public DataTable getAllItem()
        {
            return itemdal.getItem("active=1 and 1=1");
        }

        /// <summary>
        /// 根据Itemid获取styleList
        /// </summary>
        public string getStyleList(string itemid)
        {
            DataTable dt = itemdal.getItem("ID="+itemid);
            return dt.Rows[0]["stylelist"].ToString();
        }

        /// <summary>
        /// 根据ItemID获取ItemName
        /// </summary>
        public string getItemName(string itemid)
        {
            DataTable dt = itemdal.getItem("ID="+itemid);
            return dt.Rows[0]["itemName"].ToString();
        }

        /// <summary>
        /// 根据StyleID获取ItemID(对应Item内必须有且只有相应 Style)
        /// </summary>
        public string getItemByStyle(string styleid)
        {
            DataTable dt = itemdal.getItem("styleList='" + styleid + "'");
            return dt.Rows[0]["ID"].ToString();
        }
    }
}
